<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QIdentityProxyModel Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QIdentityProxyModel Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QIdentityProxyModel class proxies its source model
unmodified <a href="#details">More...</a></p>

<p>Inherits <a href="qabstractproxymodel.html">QAbstractProxyModel</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qidentityproxymodel.html#QIdentityProxyModel">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />int <b><a href="qidentityproxymodel.html#columnCount">columnCount</a></b> (<i>self</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qidentityproxymodel.html#dropMimeData">dropMimeData</a></b> (<i>self</i>, QMimeData&#160;<i>data</i>, Qt.DropAction&#160;<i>action</i>, int&#160;<i>row</i>, int&#160;<i>column</i>, QModelIndex&#160;<i>parent</i>)</li><li><div class="fn" />QModelIndex <b><a href="qidentityproxymodel.html#index">index</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>column</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qidentityproxymodel.html#insertColumns">insertColumns</a></b> (<i>self</i>, int&#160;<i>column</i>, int&#160;<i>count</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qidentityproxymodel.html#insertRows">insertRows</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>count</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />QModelIndex <b><a href="qidentityproxymodel.html#mapFromSource">mapFromSource</a></b> (<i>self</i>, QModelIndex&#160;<i>sourceIndex</i>)</li><li><div class="fn" />QItemSelection <b><a href="qidentityproxymodel.html#mapSelectionFromSource">mapSelectionFromSource</a></b> (<i>self</i>, QItemSelection&#160;<i>selection</i>)</li><li><div class="fn" />QItemSelection <b><a href="qidentityproxymodel.html#mapSelectionToSource">mapSelectionToSource</a></b> (<i>self</i>, QItemSelection&#160;<i>selection</i>)</li><li><div class="fn" />QModelIndex <b><a href="qidentityproxymodel.html#mapToSource">mapToSource</a></b> (<i>self</i>, QModelIndex&#160;<i>proxyIndex</i>)</li><li><div class="fn" />list-of-QModelIndex <b><a href="qidentityproxymodel.html#match">match</a></b> (<i>self</i>, QModelIndex&#160;<i>start</i>, int&#160;<i>role</i>, QVariant&#160;<i>value</i>, int&#160;<i>hits</i>&#160;=&#160;1, Qt.MatchFlags&#160;<i>flags</i>&#160;=&#160;Qt.MatchStartsWith|Qt.MatchWrap)</li><li><div class="fn" />QModelIndex <b><a href="qidentityproxymodel.html#parent">parent</a></b> (<i>self</i>, QModelIndex&#160;<i>child</i>)</li><li><div class="fn" />bool <b><a href="qidentityproxymodel.html#removeColumns">removeColumns</a></b> (<i>self</i>, int&#160;<i>column</i>, int&#160;<i>count</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qidentityproxymodel.html#removeRows">removeRows</a></b> (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>count</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />int <b><a href="qidentityproxymodel.html#rowCount">rowCount</a></b> (<i>self</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" /><b><a href="qidentityproxymodel.html#setSourceModel">setSourceModel</a></b> (<i>self</i>, QAbstractItemModel&#160;<i>sourceModel</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QIdentityProxyModel class proxies its source model
unmodified</p>
<p>QIdentityProxyModel can be used to forward the structure of a
source model exactly, with no sorting, filtering or other
transformation. This is similar in concept to an identity matrix
where A.I = A.</p>
<p>Because it does no sorting or filtering, this class is most
suitable to proxy models which transform the <a href="qabstractproxymodel.html#data">data</a>() of the source model. For
example, a proxy model could be created to define the font used, or
the background colour, or the tooltip etc. This removes the need to
implement all data handling in the same class that creates the
structure of the model, and can also be used to create re-usable
components.</p>
<p>This also provides a way to change the data in the case where a
source model is supplied by a third party which can not be
modified.</p>
<pre class="cpp">
 <span class="keyword">class</span> DateFormatProxyModel : <span class="keyword">public</span> <span class="type">QIdentityProxyModel</span>
 {
   <span class="comment">// ...</span>

   <span class="type">void</span> setDateFormatString(<span class="keyword">const</span> <span class="type"><a href="qstring.html">QString</a></span> <span class="operator">&amp;</span>formatString)
   {
     m_formatString <span class="operator">=</span> formatString;
   }

   <span class="type"><a href="qvariant.html">QVariant</a></span> data(<span class="keyword">const</span> <span class="type"><a href="qmodelindex.html">QModelIndex</a></span> <span class="operator">&amp;</span>index<span class="operator">,</span> <span class="type">int</span> role)
   {
     <span class="keyword">if</span> (role <span class="operator">!</span><span class="operator">=</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>DisplayRole)
       <span class="keyword">return</span> <span class="type">QIdentityProxyModel</span><span class="operator">.</span>data(index<span class="operator">,</span> role);

     <span class="keyword">const</span> <span class="type"><a href="qdatetime.html">QDateTime</a></span> dateTime <span class="operator">=</span> sourceModel()<span class="operator">-</span><span class="operator">&gt;</span>data(SourceClass<span class="operator">.</span>DateRole)<span class="operator">.</span>toDateTime();

     <span class="keyword">return</span> dateTime<span class="operator">.</span>toString(m_formatString);
   }

 <span class="keyword">private</span>:
   <span class="type"><a href="qstring.html">QString</a></span> m_formatString;
 };
</pre><hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QIdentityProxyModel" />QIdentityProxyModel.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs an identity model with the given <i>parent</i>.</p>


<h3 class="fn"><a name="columnCount" />int QIdentityProxyModel.columnCount (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#columnCount">QAbstractItemModel.columnCount</a>().</p>


<h3 class="fn"><a name="dropMimeData" />bool QIdentityProxyModel.dropMimeData (<i>self</i>, <a href="qmimedata.html">QMimeData</a>&#160;<i>data</i>, <a href="qt.html#DropAction-enum">Qt.DropAction</a>&#160;<i>action</i>, int&#160;<i>row</i>, int&#160;<i>column</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#dropMimeData">QAbstractItemModel.dropMimeData</a>().</p>


<h3 class="fn"><a name="index" /><a href="qmodelindex.html">QModelIndex</a> QIdentityProxyModel.index (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>column</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#index">QAbstractItemModel.index</a>().</p>


<h3 class="fn"><a name="insertColumns" />bool QIdentityProxyModel.insertColumns (<i>self</i>, int&#160;<i>column</i>, int&#160;<i>count</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#insertColumns">QAbstractItemModel.insertColumns</a>().</p>


<h3 class="fn"><a name="insertRows" />bool QIdentityProxyModel.insertRows (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>count</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#insertRows">QAbstractItemModel.insertRows</a>().</p>


<h3 class="fn"><a name="mapFromSource" /><a href="qmodelindex.html">QModelIndex</a> QIdentityProxyModel.mapFromSource (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>sourceIndex</i>)</h3><p>Reimplemented from <a href="qabstractproxymodel.html#mapFromSource">QAbstractProxyModel.mapFromSource</a>().</p>


<h3 class="fn"><a name="mapSelectionFromSource" /><a href="qitemselection.html">QItemSelection</a> QIdentityProxyModel.mapSelectionFromSource (<i>self</i>, <a href="qitemselection.html">QItemSelection</a>&#160;<i>selection</i>)</h3><p>Reimplemented from <a href="qabstractproxymodel.html#mapSelectionFromSource">QAbstractProxyModel.mapSelectionFromSource</a>().</p>


<h3 class="fn"><a name="mapSelectionToSource" /><a href="qitemselection.html">QItemSelection</a> QIdentityProxyModel.mapSelectionToSource (<i>self</i>, <a href="qitemselection.html">QItemSelection</a>&#160;<i>selection</i>)</h3><p>Reimplemented from <a href="qabstractproxymodel.html#mapSelectionToSource">QAbstractProxyModel.mapSelectionToSource</a>().</p>


<h3 class="fn"><a name="mapToSource" /><a href="qmodelindex.html">QModelIndex</a> QIdentityProxyModel.mapToSource (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>proxyIndex</i>)</h3><p>Reimplemented from <a href="qabstractproxymodel.html#mapToSource">QAbstractProxyModel.mapToSource</a>().</p>


<h3 class="fn"><a name="match" />list-of-QModelIndex QIdentityProxyModel.match (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>start</i>, int&#160;<i>role</i>, QVariant&#160;<i>value</i>, int&#160;<i>hits</i>&#160;=&#160;1, <a href="qt-matchflags.html">Qt.MatchFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.MatchStartsWith|Qt.MatchWrap)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#match">QAbstractItemModel.match</a>().</p>


<h3 class="fn"><a name="parent" /><a href="qmodelindex.html">QModelIndex</a> QIdentityProxyModel.parent (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>child</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#parent">QAbstractItemModel.parent</a>().</p>


<h3 class="fn"><a name="removeColumns" />bool QIdentityProxyModel.removeColumns (<i>self</i>, int&#160;<i>column</i>, int&#160;<i>count</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#removeColumns">QAbstractItemModel.removeColumns</a>().</p>


<h3 class="fn"><a name="removeRows" />bool QIdentityProxyModel.removeRows (<i>self</i>, int&#160;<i>row</i>, int&#160;<i>count</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#removeRows">QAbstractItemModel.removeRows</a>().</p>


<h3 class="fn"><a name="rowCount" />int QIdentityProxyModel.rowCount (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#rowCount">QAbstractItemModel.rowCount</a>().</p>


<h3 class="fn"><a name="setSourceModel" />QIdentityProxyModel.setSourceModel (<i>self</i>, <a href="qabstractitemmodel.html">QAbstractItemModel</a>&#160;<i>sourceModel</i>)</h3><p>Reimplemented from <a href="qabstractproxymodel.html#setSourceModel">QAbstractProxyModel.setSourceModel</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>